import { Body, Controller, Post } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger';
import { ADMIN_PREFIX } from '../../admin.constants';
import { ReportFormDailyProductionQuotaService } from './dailyProductionQuota.service';

@ApiSecurity(ADMIN_PREFIX)
@ApiTags('每日生产运行指标模块')
@Controller('dailyProductionQuota')
export class ReportFormDailyProductionQuotaController {
  constructor(private dailyProductionQuotaService: ReportFormDailyProductionQuotaService) {}

  @ApiOperation({ summary: '分页获取每日生产运行指标列表' })
  @ApiOkResponse()
  @Post('page')
  async page(@Body() dto) {
    const [list, total] = await this.dailyProductionQuotaService.page(dto);

    return {
      list,
      pagination: {
        total,
        pageNum: dto.pageNum,
        pageSize: dto.pageSize,
      },
    };
  }
}
